<template>
	<!--经济增长衡量指数-->
	<div class="growth-index">
		<div class="topBox">
			<el-row>
				<el-col span="8">
					<div style="margin:0 .5vw">
						<chart-block chartID="chart1" :title="BarAndLineOptionData.title" :optionData="BarAndLineOptionData" chartType="getPictorialBarAndLine" height="40vh" style="padding:0 1vh 2vh 0;margin-top:1vh;"></chart-block>
					</div>
				</el-col>
				<el-col span="8">
					<div style="margin:0 .5vw">
						<chart-block chartID="chart2" :title="lineOptionData.title" :optionData="lineOptionData" chartType="getLine" height="40vh" style="padding:0 1vh 2vh 0;margin-top:1vh;"></chart-block>
					</div>
				</el-col>
				<el-col span="8">
					<div style="margin:0 .5vw">
						<chart-block chartID="chart3" :title="pictorialBarOptionData.title" :optionData="pictorialBarOptionData" chartType="getPictorialBar" height="40vh" style="padding:0 1vh 2vh 0;margin-top:1vh;"></chart-block>
					</div>
				</el-col>
			</el-row>
		</div>
		<div class="bottomBox">
			<el-row>
				<el-col span="8">
					<div style="margin:0 .5vw">
						<chart-block chartID="chart4" :title="PolarBarOptionData.title" :optionData="PolarBarOptionData" chartType="getpolarBar" height="40vh" style="padding:0 1vh 2vh 0"></chart-block>
					</div>
				</el-col>
				<el-col span="8">
					<div style="margin:0 .5vw">
						<chart-block chartID="chart5" :title="barOptionData.title" :optionData="barOptionData" chartType="getBar" height="40vh" style="padding:0 1vh 2vh 0"></chart-block>
					</div>
				</el-col>
				<el-col span="8">
					<div style="margin:0 .5vw">
						<chart-block chartID="chart6" :title="optionData.title" :optionData="optionData" chartType="getStackBar" height="40vh" style="padding:0 1vh 2vh 0"></chart-block>
					</div>
				</el-col>
			</el-row>
		</div>
	</div>
</template>

<script>
import {geteconomyData,geteconomyData1,geteconomyData2,geteconomyData3,geteconomyData4,geteconomyData5} from '@/api/pages.js'
export default {
	name: "growth-index",
	components: {
		ChartBlock: () => import('@/components/chart-block')
	},
	props: {},
	data() {
		return {
			pictorialBarOptionData:{
				LinearGradientColor:[//柱状图渐变色
					{
						topColor:'#3af5c4',
						bottomColor:'#43eb84'
					},
				],
				seriesData: [
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
				],
			},
			lineOptionData:{
				color:['#32e9f4','#f1db25','#fc684b'],
				seriesData: [
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
				],
			},
			BarAndLineOptionData:{
				LinearGradientColor:[//柱状图渐变色
					{
						topColor:'#47eaf9',
						bottomColor:'#0693d5'
					},
				],
				seriesData: [
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
				],
			},
			optionData:{
				seriesData: [
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
				],
			},
			barOptionData:{
				LinearGradientColor:[//柱状渐变颜色
					{
						topColor:'#4761ff',
						bottomColor:'#0ecbff'
					},
					{
						topColor:'#fd654e',
						bottomColor:'#f18c27'
					},
				],
				seriesData: [
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
				],
			},
			PolarBarOptionData:{
				seriesData: [
					{
						name: '', //如果有图例，这个就不能为空
						data: [], //数据
						unit: '', //数据的单位
					},
				],
			}
		}
	},
	computed: {},
	created() {

	},
	mounted() {
		this.geteconomyData('E014')
		this.geteconomyData1('E016')
		this.geteconomyData2('E018')
		this.geteconomyData3('E015')
		this.geteconomyData4('E017')
		this.geteconomyData5('E019')
	},
	methods: {
		// 经济指标挖掘分析-经济增长衡量指数-生产总值及同比增速
		geteconomyData(busiCode){
			geteconomyData(busiCode).then(res=>{
				if(res.data.code==200){
					this.BarAndLineOptionData={
						title:res.data.data.title,
						categoryAxis: res.data.data.categoryAxis, //类目轴数据
						seriesData: res.data.data.seriesData,
						LinearGradientColor:[//柱状图渐变色
							{
								topColor:'#47eaf9',
								bottomColor:'#0693d5'
							},
						],
						LineCircleColor:"#eae73c",//折线图颜色
						LineCircleBorderColor:"#eae73c",//折线图描边颜色
					}
				}
			}).catch(err=>{

			})
		},
		// 经济指标挖掘分析-经济增长衡量指数-生产总值及同比增速
		geteconomyData1(busiCode){
			geteconomyData1(busiCode).then(res=>{
				if(res.data.code==200){

					this.lineOptionData = {
						color:['#32e9f4','#f1db25','#fc684b'],
						title:res.data.data.title,
						// legendPosition:'center',
						categoryAxis:res.data.data.categoryAxis, //类目轴数据
						seriesData: res.data.data.seriesData
					}
				}
			}).catch(err=>{

			})
		},
		// 经济指标挖掘分析-经济增长衡量指数-人均总产值变化
		geteconomyData2(busiCode){
			geteconomyData2(busiCode).then(res=>{
				if(res.data.code==200){
					this.pictorialBarOptionData = {
						title:res.data.data.title,
						categoryAxis: res.data.data.categoryAxis, //类目轴数据
						seriesData: res.data.data.seriesData,
						LinearGradientColor:[//柱状图渐变色
							{
								topColor:'#3af5c4',
								bottomColor:'#43eb84'
							},
						],
						LineCircleColor:'',
						LineCircleBorderColor:''
					}
				}
			}).catch(err=>{

			})
		},
		// 经济指标挖掘分析-经济增长衡量指数-固定资产投资总额变化
		geteconomyData3(busiCode){
			geteconomyData3(busiCode).then(res=>{
				if(res.data.code==200){
					this.PolarBarOptionData={
						title:res.data.data.title,
						categoryAxis: res.data.data.categoryAxis, //类目轴数据
						seriesData:res.data.data.seriesData[0].data,
						unit:res.data.data.seriesData[0].unit,
						topColor:'#ee818f',
						bottomColor:'#12a4dc'
					}
				}
			}).catch(err=>{

			})
		},
		// 经济指标挖掘分析-经济增长衡量指数-地方财政收入支出变化
		geteconomyData4(busiCode){
			geteconomyData4(busiCode).then(res=>{
				if(res.data.code==200){
					this.barOptionData = {
						title:res.data.data.title,
						categoryAxis: res.data.data.categoryAxis, //类目轴数据
						seriesData: res.data.data.seriesData,
						LinearGradientColor:[//柱状渐变颜色
							{
								topColor:'#4761ff',
								bottomColor:'#0ecbff'
							},
							{
								topColor:'#fd654e',
								bottomColor:'#f18c27'
							},
						]
					}
				}
			}).catch(err=>{

			})
		},
		// 经济指标挖掘分析-经济增长衡量指数-工农业生产总值变化
		geteconomyData5(busiCode){
			geteconomyData5(busiCode).then(res=>{
				if(res.data.code==200){
					this.optionData = {
						title:res.data.data.title,
						categoryAxis: res.data.data.categoryAxis, //类目轴数据
						seriesData: res.data.data.seriesData,
						color:["#03cefa","#f1db25","#fd664d"],
					}
				}
			}).catch(err=>{

			})
		},
	},
	watch: {}
}
</script>

<style scoped lang="scss">
.growth-index {
	width:100%;
	height:100%;
	.topBox{
		width:100%;
		height:49%;
	}
	.bottomBox{
		width:100%;
		height:49%;
		margin-top:1.5vh
	}
}
</style>
